[Unit]
Description=Flanneld overlay address etcd agent
After=network.target
After=network-online.target
Wants=network-online.target
After=etcd.service
Before=docker.service

[Service]
Type=notify
ExecStart=/root/local/bin/flanneld \
{% if etcd_use_ssl %}
  -etcd-cafile=/etc/kubernetes/ssl/ca.pem \
  -etcd-certfile=/etc/flanneld/ssl/flanneld.pem \
  -etcd-keyfile=/etc/flanneld/ssl/flanneld-key.pem \
{% endif %}
  -etcd-endpoints={% for host in groups['etcdservers'] %}http{% if etcd_use_ssl %}s{% endif %}://{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:2379{% if not loop.last%},{%endif%}{% endfor %} \
  -etcd-prefix={{FLANNEL_ETCD_PREFIX}}
ExecStartPost=/root/local/bin/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker
Restart=on-failure

[Install]
WantedBy=multi-user.target
RequiredBy=docker.service